/* eslint-disable no-unused-vars */
/* eslint-disable id-match */
/*
 * FilePath     : \src\mock\index.ts
 * Author       : 苏军志
 * Date         : 2024-01-16 11:13
 * LastEditors  : 苏军志
 * LastEditTime : 2024-01-16 11:38
 * Description  : 模拟数据
 * CodeIterationRecord:
 */
import Mock from "mockjs";
import apis from "./apis/index";

interface MockParams {
  url: string;
  type: string;
  data?: any;
  params?: any;
  response(option?: any): Record<string, unknown>;
}
/**
 * description: 设置超时时间
 */
Mock.setup({
  timeout: "300"
});

/**
 * description: 定义Mock请求
 */
export function mockRequest() {
  let api: MockParams;
  for (api of apis) {
    Mock.mock(new RegExp(api.url), api.type || "get", api.response);
  }
}
